// 病厉页面模板
<template>
  <div id="medicalHistory" :class="['left', 'contentWidth' , {'mainBig': $store.state.isCollapse ,'mainSmall': !$store.state.isCollapse }]">
    <div class="header">
      <div class="backTo" v-show="isBackShow" @click="back">
        <img src="../../../static/images/back.png" alt="返回" />
      </div>
      <div class="contentTopLeft left">
        <h2>病历</h2>
      </div>
      <maintopright></maintopright>
      <maintopleftbottom></maintopleftbottom>
    </div>
    <keep-alive>
      <router-view></router-view>
    </keep-alive>
  </div>
</template>
<script>
import maintopright from '@/components/main/maintop/maintopRight'
import maintopleftbottom from '@/components/main/maintop/maintopLeftBottom'
  export default {
    data() {
      return {
        isBackShow : false
      }
    },
    mounted() {
      this.isRoute() 
    },
    watch: {
      $route: {
        handler(val, oldval) {
          if (val.path == "/medicalHistory" || val.path == "/medicalHistory/medicalHistoryList") {
            this.isBackShow = false;
          } else {
            this.isBackShow = true;
          }
        },
      }
    },
    methods: {
      back() {
        if (window.history.length <= 1) {
          this.$router.push({ path: '/' })
          return false
        } else {
          this.$router.go(-1)
        }
      },
      isRoute() {
        if (this.$route.path == '/medicalHistory' || this.$route.path == '/medicalHistory/medicalHistoryList') {
          this.isBackShow = false;
        } else {
          this.isBackShow = true;
        }
        }
    },
    components:{
    	maintopright,
      maintopleftbottom,
    }
}

</script>
<style scoped>

</style>
